<?php
use admin\components\AdminAsset;
use yii\helpers\Html;
use yii\helpers\Url;
use app\utils\SettingUtils;

AdminAsset::register($this);
?>
<?php $this->beginPage(); ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title); ?> -- <?= SettingUtils::get('web_name'); ?></title>
    <?php $this->head(); ?>
</head>
<body>
<?php $this->beginBody(); ?>
<div class="wrapper">
    <div id="header" class="header">
        <a href="<?= Url::to(['/']); ?>" class="navbar-brand"><?= SettingUtils::get('web_name'); ?>管理后台</a>
        <nav class="navbar navbar-static-top" role="navigation">
            <ul class="nav navbar-right pull-right">
                <li class="dropdown">
                    <a data-toggle="dropdown" class="dropdown-toggle" href="javascript:;" aria-expanded="true">
                        <i class="glyphicon glyphicon-user"></i>
                        <span><?= Yii::$app->user->identity->author; ?> <i class="caret"></i></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li class="user-header"><?= Html::img('/assets/admin/images/avatar.png'); ?></li>
                        <li class="user-footer">
                            <div class="pull-left">
                                <a class="btn dialog" href="<?= Url::to(['user/save', 'id' => Yii::$app->user->id])?>">修改密码</a>
                            </div>
                            <div class="pull-right">
                                <a class="btn cancel" href="<?= Url::to(['default/logout']); ?>">退出登录</a>
                            </div>
                            <div class="clearfix"></div>
                        </li>
                    </ul>
                </li>
            </ul>
        </nav>
    </div>

    <div class="left" id="left">
        <div class="sidebar">
            <div class="user-panel">
                <div class="pull-left image"><?= Html::img('/assets/admin/images/avatar.png'); ?></div>
                <div class="pull-left info">
                    <p>Hello, <?= Yii::$app->user->identity->username; ?></p>
                    <a href="<?= Url::to(['default/logout']); ?>">
                        <i class="fa fa-sign-out fa-fw"></i> 退出登录
                    </a>                
                </div>
            </div>
            <?= \admin\widgets\AdminMenuWidget::widget(); ?>
        </div>
    </div>
    <div class="right" id="right">
        <?= \yii\widgets\Breadcrumbs::widget([
            'encodeLabels' => FALSE,
            'homeLink' => ['label' => '<span class="fa fa-tachometer"></span>控制台', 'url' => ['/']],
            'links' => $this->params['breadcrumbs']
        ]); ?>
        <div class="container-fluid">
            <?= $content; ?>
        </div>
    </div>
</div>
<?php $this->endBody(); ?>
</body>
</html>
<?php $this->endPage(); ?>
